﻿@inherits NFinal.View.RazorView<ModelData>
@using NFinalCompiler.SqlModel;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace @Model.ModelNameSpace.@Model.DataBaseShortName
{
    /// <summary>
    /// @Model.Table.Description
    ///</summary>
    [Serializable]
    [DataBase("@Model.DataBaseName","@Model.DataBaseShortName","@Model.DataBaseType")]
    [Table("@Model.Table.Name")]
    public partial class @(ModelHelper.GetTableName(Model.Table))Info
    {
        #region 私有变量
        @foreach (var col in Model.Table.Columns)
        {
            @:private @ModelHelper.GetColType(col,Model.EnumNameSpace) @ModelHelper.GetPrivateName(col.Name)@(ModelHelper.FiledDefaultValue(col))///@col.Description
        }
        #endregion

        #region 数据库model
        @foreach (var col in Model.Table.Columns)
        {
            @:/// <summary>
            @:/// @col.Description
            @:///</summary>@(col.IsPrimaryKey ? "\r\n            [Key]" : "")@(col.IsAutoNumber ? "\r\n            [DatabaseGenerated(DatabaseGeneratedOption.Identity)]" : "")@(col.IsComputed ? "\r\n            [DatabaseGenerated(DatabaseGeneratedOption.Computed)]" : "")@(col.DataType.NetDataTypeCSharpName == "geography" ? "\r\n            [NotMapped]" : "\r\n            [Column(\"" + col.Name + "\")]")
            @:public @ModelHelper.GetColType(col,Model.EnumNameSpace) @(ModelHelper.GetName(col.Name))
            @:{
                @:set { @ModelHelper.GetPrivateName(col.Name) = value; }
                @:get { return @ModelHelper.GetPrivateName(col.Name) ; }
            @:}
            @:
        }
        #endregion
    }
}